package me.minecraft.plugin.itemrecycle.manager;

import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author langle__
 * @version 1.0
 */
public class DropItemManager {

    public static final DropItemManager INSTANCE = new DropItemManager();

    private final List<ItemStack> dropItemList = new ArrayList<>();

    private DropItemManager() {}

    public void addDropItem(ItemStack item) {
        dropItemList.add(item);
    }

    public void removeDropItem(ItemStack item) {
        dropItemList.remove(item);
    }

    public List<ItemStack> getDropItemList() {
        return Collections.unmodifiableList(dropItemList);
    }

    public ItemStack getDropItem(int index) {
        if (index < 0 || index >= dropItemList.size()) return null;
        return dropItemList.get(index);
    }

    public ItemStack removeDropItem(int index) {
        if (index < 0 || index >= dropItemList.size()) return null;
        return dropItemList.remove(index);
    }

    public void clear() {
        dropItemList.clear();
    }

    public int size() {
        return dropItemList.size();
    }

    public boolean isEmpty() {
        return dropItemList.isEmpty();
    }

    public boolean contains(ItemStack item) {
        return dropItemList.contains(item);
    }

}
